<template>
  <div>
    <!-- 可用人员详情Table -->
    <p-table
        ref="table"
        size="middle"
        bordered
        rowKey="id"
        :scroll="tableScroll"
        :customRow="clickThenSelect"
        :columns="defColumns"
        :dataSource="dataSource"
    >
      <template slot="qualified" slot-scope="text,row">
        <input type="text" v-model="row.qualifiedNum" @input="tabchange(text,row)">
      </template>

      <template slot="unqualified" slot-scope="text,row">
        <input type="text" v-model="row.productNum" @input="tabUnChange(text,row)">
      </template>
      
    </p-table>
  </div>
</template>  

                    <script>
import { postAction, getAction, deleteAction } from "@/api/manage";
import Vue from "vue";

export default {
  name: "",
  props: {
    numberList: {
      type: Array,
      default() {
        return [];
      },
    },
  },

  data() {
    return {
      loading:false,
      dataSource:[],
      qualified:"",
      unqualified:"",
      EnhanceJS: "",
      cgButtonLinkList: [],
      selectedRowKeys:[],
      cgButtonList: [],
      title: "", //存表名
      groupTag: [],
      queryInfo: [],
      code: "",
      // 表头
      columns: [],
      //列设置
      settingColumns: [],
      //列定义
      defColumns: [
        {
          title: "序号",
          dataIndex: "id",
          key: "rowIndex",
          width: 60,
          align: "center",
          customRender: function (t, r, index) {
            return parseInt(index) + 1;
          },
        },
        {
          title: "生产工单",
          dataIndex: "productionno",
          key: "productionno",
          // width: "15%",
          align: "center",
          scopedSlots: { customRender: "productionno" },
        },
        {
          title: "工序工单",
          dataIndex: "processbillno",
          key: "processbillno",
          // width: "40%",
          align: "center",
          scopedSlots: { customRender: "processbillno" },
        },

        {
          title: "合格数量",
          dataIndex: "qualified",
          key: "qualified",
          align: "center",
          scopedSlots: { customRender: "qualified" },
        },
        {
          title: "不合格数量",
          dataIndex: "unqualified",
          key: "classunqualifiedname",
          align: "center",
          scopedSlots: { customRender: "unqualified" },
        },
        
      ],
    };
  },
  watch:{
    numberList(){
      this.loadData()
    },
  },
  created() {
    this.loadData()
  },
  methods: {
    tabchange(text,row){
    },
    tabUnChange(text,row){
      this.$emit('geiChildData',this.dataSource)
    },
    
    loadData(){
      let arr=[]
      this.numberList.forEach(item=>{
        let obj={
        processbillno:item.productionno,
        productionno:item.productionno,
        qualifiedNum:this.qualified,
        productNum:this.unqualified,
        id:item.id
        }
        arr.push(obj)
      })
      
      this.dataSource=arr
    }
  },
};
</script>
<style  scoped>
input{
  border:none;
  outline:none;
  text-align: center;
}
</style>